#include <iostream>
using namespace std;
 
int main()
{
    int left = 0, right = 0, cnt;
    cin >> left >> right;
    for (int i = left; i <= right; ++i)
    {
        int tmp = i;
        while (tmp)
        {
            if (tmp % 10 == 2)
            {
                ++cnt;
            }
            tmp /= 10;
        }
    }
    cout << cnt << endl;
    return 0;
}